﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ZNGL_Form.aspx.cs" Inherits="RenShiKaoQin.Account.ZNGL_Form" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true">
</ajaxToolkit:ToolkitScriptManager>
<div align="center" style="margin-left: 40px">
    输入姓名<asp:TextBox ID="tbName" runat="server"></asp:TextBox><asp:Button ID="btnSearch"
        runat="server" Text="查找" />
    <asp:GridView ID="gvPeople" runat="server" AutoGenerateColumns="False" 
        CellPadding="4" DataKeyNames="FEmployeeID" DataSourceID="sqlPeople" 
        Font-Size="17px" ForeColor="#333333" GridLines="None" 
        onrowcommand="gvPeople_RowCommand" EmptyDataText="没有符合条件的数据">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="FName" HeaderText="姓名" SortExpression="FName" />
            <asp:BoundField DataField="DeptName" HeaderText="所在科室" 
                SortExpression="DeptName" />
            <asp:TemplateField HeaderText="选择">
                <ItemTemplate>
                    <asp:LinkButton ID="lkbFH" runat="server" CommandName="SelectPeople" Text="选择" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>'></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="FEmployeeID" HeaderText="FEmployeeID" 
                ReadOnly="True" SortExpression="FEmployeeID" Visible="False" />
            <asp:BoundField DataField="FDeptCode" HeaderText="FDeptCode" 
                SortExpression="FDeptCode" Visible="False" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:HiddenField ID="hfID" runat="server" /><asp:HiddenField ID="hfDept" runat="server" />
    <asp:SqlDataSource ID="sqlPeople" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
        
        SelectCommand="SELECT TEmployee.FEmployeeID, TEmployee.FName, TEmployee.FOldName, TEmployee.FGenderCode, TEmployee.FNationCode, TEmployee.FBirthday, TEmployee.FCardID, TEmployee.FPublicID, TDictDept.FName AS DeptName, TDept.FDeptCode FROM TEmployee INNER JOIN TDept ON TEmployee.FEmployeeID = TDept.FEmployeeID INNER JOIN TDictDept ON TDept.FDeptCode = TDictDept.FDeptCode WHERE (TEmployee.FName = @EmployeeName) AND (TDept.FValidDate = (SELECT MAX(FValidDate) AS Expr1 FROM TDept AS TDept_1 WHERE (FEmployeeID = TEmployee.FEmployeeID)))">
        <SelectParameters>
            <asp:ControlParameter ControlID="tbName" Name="EmployeeName" 
                PropertyName="Text" />
        </SelectParameters>
    </asp:SqlDataSource>
    <table cellpadding="3" cellspacing="0">
    <tr><td>姓名</td><td><asp:Label ID="lbName" runat="server" /></td><td>所在科室</td><td><asp:Label ID="lbDept" runat="server" /></td></tr>
    <tr><td>起始日期</td><td><asp:TextBox ID="tbStartDate" runat="server" Width="100%" /><ajaxToolkit:CalendarExtender ID="caltbStart" TargetControlID="tbStartDate" runat="server" Format="yyyy-MM-dd" DefaultView="Months"></ajaxToolkit:CalendarExtender></td><td>结束日期</td><td>
        <asp:TextBox ID="tbEndDate" runat="server" Width="100%" /><ajaxToolkit:CalendarExtender ID="caltbEnd" TargetControlID="tbEndDate" runat="server" Format="yyyy-MM-dd" DefaultView="Months"></ajaxToolkit:CalendarExtender></td></tr>
    <tr><td>请假类型</td><td><asp:DropDownList ID="ddlType" runat="server" 
            DataSourceID="sqlKQType" DataTextField="FName" 
            DataValueField="FKQTypeCode" Width="100%"></asp:DropDownList>
        <asp:SqlDataSource ID="sqlKQType" runat="server" 
            ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
            SelectCommand="SELECT FKQTypeCode, FName FROM TDictKQType">
        </asp:SqlDataSource>
        </td><td>请假事由</td><td><asp:TextBox ID="tbMemo" runat="server" Width="100%"></asp:TextBox></td></tr>
        <tr><td colspan="4"><asp:Button ID="btnSubmit" runat="server" Text="提交请假记录" 
                BorderStyle="None" onclick="btnSubmit_Click" Width="100%" /></td></tr>
    </table>
    <asp:GridView ID="gvApplication" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="SerialNO" 
        DataSourceID="sqlApplication" ForeColor="#333333" GridLines="None" 
        Font-Size="15px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="EmployeeName" HeaderText="姓名" 
                SortExpression="EmployeeName" />
            <asp:BoundField DataField="DeptName" HeaderText="所在科室" 
                SortExpression="DeptName" />
            <asp:BoundField DataField="StartDate" DataFormatString="{0:yyyy-MM-dd}" 
                HeaderText="起始时间" SortExpression="StartDate" />
            <asp:BoundField DataField="EndDate" DataFormatString="{0:yyyy-MM-dd}" 
                HeaderText="结束时间" SortExpression="EndDate" />
            <asp:BoundField DataField="KQType" HeaderText="休假类型" SortExpression="KQType" />
            <asp:BoundField DataField="Memo" HeaderText="休假事由" SortExpression="Memo" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="sqlApplication" runat="server" 
        ConnectionString="<%$ ConnectionStrings:hrdbConnectionString %>" 
        
        SelectCommand="SELECT TKQRequestRecord.FEmployeeID, TKQRequestRecord.StartDate, TKQRequestRecord.EndDate, TKQRequestRecord.TypeCode, TKQRequestRecord.Memo, TKQRequestRecord.ExamStatus, TKQRequestRecord.CheckStatus, TKQRequestRecord.SerialNO, TKQRequestRecord.ReadStatus, TKQRequestRecord.DeptCode, TKQRequestRecord.CheckerID, TKQRequestRecord.ExamerID, TKQRequestRecord.CheckDate, TKQRequestRecord.ExamDate, TDictKQType.FName AS KQType, TDictDept.FName AS DeptName, TEmployee.FName AS EmployeeName FROM TKQRequestRecord INNER JOIN TDictKQType ON TKQRequestRecord.TypeCode = TDictKQType.FKQTypeCode INNER JOIN TDept ON TKQRequestRecord.FEmployeeID = TDept.FEmployeeID INNER JOIN TDictDept ON TDept.FDeptCode = TDictDept.FDeptCode INNER JOIN TEmployee ON TEmployee.FEmployeeID = TKQRequestRecord.FEmployeeID WHERE (TKQRequestRecord.ExamerID = @UserID) AND (TKQRequestRecord.CheckerID = @UserID) AND (TDept.FValidDate = (SELECT MAX(FValidDate) AS Expr1 FROM TDept AS TDept_1 WHERE (FEmployeeID = TKQRequestRecord.FEmployeeID))) ORDER BY TKQRequestRecord.StartDate DESC, EmployeeName, DeptName">
        <SelectParameters>
            <asp:Parameter Name="UserID" />
        </SelectParameters>
    </asp:SqlDataSource>
</div>
</asp:Content>
